package demo3;
// 定义泛型类 Box
class Box<T> {
    private T content;

    public void put(T content) {
        this.content = content;
    }

    public T get() {
        return content;
    }
}

public class GenericExample {
    public static void main(String[] args) {
        // 创建 Box 类的对象，存储整数
        Box<Integer> integerBox = new Box<>();
        integerBox.put(10);
        System.out.println("Integer box content: " + integerBox.get());

        // 创建 Box 类的对象，存储字符串
        Box<String> stringBox = new Box<>();
        stringBox.put("Hello, World!");
        System.out.println("String box content: " + stringBox.get());
    }
}
